<!--
 * @Author: ShiJunJie
 * @Date: 2021-09-07 17:32:15
 * @LastEditors: ShiJunJie
 * @LastEditTime: 2021-09-08 15:23:50
 * @Descripttion: 
-->
<template>
  <div>
    <button @click="goBack()">退出登录</button>
    <button @click="router.push('/500')">不存在的界面</button>
    <h1>首页</h1>

    <h5>新增的路由界面</h5>
    <p @click="goBack(e.path)" v-for="(e, i) in newRoute" :key="i">{{ e.name }}</p>
  </div>
</template>

<script setup>
  import storage from 'good-storage'
  import { useRouter } from 'vue-router'
  const router = useRouter()

  const newRoute = storage.get('USER_ROUTERS')

  const goBack = (url) => {
    if (!url) {
      storage.clear()
    }
    router.push(url || '/user/login')
  }
</script>

<style lang="less" scoped>
  p {
    cursor: pointer;
    color: blue;
  }
</style>
